/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.srcptit.trainning.thompv.btvn1;
import java.util.Scanner;
/**
 *
 * @author SONY
 */
public class Bai2Muc2 
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int n;
        n=sc.nextInt();
        int []a=new int[1000];
        int []c=new int [1000];
        for(int i=1;i<=n;i++)
        {
            c[i]=1;
            a[i]=sc.nextInt();
        }
        for(int i=1;i<=n;i++)
            for(int j=i+1;j<=n;j++)
                if(a[i]==a[j]&&c[i]!=0)
                {
                    c[i]++;
                    c[j]=0;
                }
        for(int i=1;i<=n;i++)
            if(c[i]!=0)
                System.out.println(a[i]+ " xuat hien " +c[i]+ " lan");
    }
}
